<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:s="http://jboss.com/products/seam/taglib"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:rich="http://richfaces.org/rich"
                xmlns:a4j="http://richfaces.org/a4j"
                template="layout/site-template.xhtml">

    <ui:define name="menu">
        <ui:include src="view/includes/menu/richmenuform.xhtml"/>
    </ui:define>

    <ui:define name="page-title">
        <h:outputText value="#{categoryHome.instance.name}"
                      rendered="#{!empty param.catId}"/>
        <h:outputText value="#{defaultCategory.name}"
                      rendered="#{empty param.catId}"/>
    </ui:define>

    <ui:define name="left-content">
        <h:form>
            <rich:tree style="width:300px"
                       switchType="ajax"
                       componentState="#{treeNodeUtil.componentState}"
                       adviseNodeOpened="#{treeNodeUtil.adviseNodeOpened}">
                <rich:treeNodesAdaptor nodes="#{parentCategories}" var="_cat">
                    <rich:treeNode data="#{_cat.id}">
                        <s:link value="#{_cat.name}"
                                view="/products.xhtml"
                                title="#{_cat.name}"
                                propagation="none">
                            <f:param name="catId"
                                     value="#{_cat.id}"/>
                        </s:link>
                    </rich:treeNode>
                    <rich:treeNodesAdaptor nodes="#{_cat.children}" var="_childCat">
                        <rich:treeNode data="#{_childCat.id}">
                            <s:link value="#{_childCat.name}"
                                    view="/products.xhtml"
                                    title="#{_childCat.name}"
                                    propagation="none">
                                <f:param name="catId"
                                         value="#{_childCat.id}"/>
                                <f:param name="isChild"
                                         value="true"/>
                            </s:link>
                        </rich:treeNode>
                    </rich:treeNodesAdaptor>
                </rich:treeNodesAdaptor>
            </rich:tree>
        </h:form>
    </ui:define>

    <ui:define name="main-content-body">
        <h:form styleClass="maincontentform">
            <rich:dataGrid value="#{productForCategory}"
                           var="_product"
                           columns="3"
                           elements="6"
                           width="600px"
                           styleClass="resultsdatagrid">
                <rich:panel bodyClass="pbody" styleClass="productitempanel">
                    <f:facet name="header">
                        <s:link value="#{_product.name}"
                                view="/product.xhtml"
                                title="#{_product.name}">
                            <f:param name="prodId"
                                     value="#{_product.id}"/>
                        </s:link>
                    </f:facet>
                    <rich:dataList value="#{_product.files}"
                                   var="_file"
                                   styleClass="imagelist">
                        <s:link view="/product.xhtml"
                                title="#{_product.name}">
                            <f:param name="prodId"
                                     value="#{_product.id}"/>
                            <s:graphicImage value="#{_file.croppedByte.image}"
                                            fileName="#{_file.id}_small"
                                            alt="[image]">
                                <s:transformImageSize width="60"
                                                      maintainRatio="true"/>
                            </s:graphicImage>
                        </s:link>
                    </rich:dataList>
                    <h:outputText value="#{_product.description}"
                                  escape="false"/>
                </rich:panel>
                <f:facet name="footer">
                    <rich:datascroller>
                        <s:conversationId/>
                    </rich:datascroller>
                </f:facet>
            </rich:dataGrid>
        </h:form>
    </ui:define>

    <ui:define name="footer">
        <h4>adm 'at' glxn.net </h4>
    </ui:define>
</ui:composition>
